<template>
  <div >
    <My ref="my"></My>
    
    <h1 ref="he">你好</h1>

    <button @click="showMy">点我输出上面的DOM</button>
  </div>
</template>

<script>
    import My from './components/My.vue'
    export default {
        name: "App",
        components: { My },
        methods:{
            showMy(){
                console.log(this);//this指向是vc组件
                console.log(this.$refs.my);//通过 ref 属性，可以在组件中访问子组件或DOM元素，
                console.log(this.$refs.he);
            }
        }

    }
    
</script>

